package com.llq.studentinfo;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

public class PasswordGeneratorTest{
	public class MockRandom extends java.util.Random{
		/**
		 * 
		 */
		private static final long serialVersionUID = 1L;
		private int i;
		public MockRandom(char c) {
			i=c-PasswordGenerator.LOW_END_PASSWORD_CHAR;
		}
		@Override
		protected int next(int bits) {
			return i++;
		}
		

	}
	@Test
	public void generatePassword(){
		PasswordGenerator generator=new PasswordGenerator();
		generator.setRandom(new MockRandom('A'));
		assertEquals("ABCDEFGH", generator.generatePassword());
		generator.setRandom(new MockRandom('C'));
		assertEquals("CDEFGHIJ", generator.generatePassword());
	}

}
